Skip to content

Commit

Permalink
xhc-hb04.tcl: provide defaults if missing ini item
Browse files Browse the repository at this point in the history
If ini seting [XHC_HB04_CONFIG]mpg_accels item was omitted,
error reported was misleading, example:

"Missing ini setting: [AXIS_X]MAX_ACCELERATION"

So, provide defaults so mpg_accels is not required.
  • Loading branch information
dngarrett committed Oct 3, 2018
1 parent 5e69430 commit cb934ee
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/hallib/xhc-hb04.tcl
Expand Up @@ -124,6 +124,9 @@ proc connect_pins {} {
} ;# connect_pins

proc wheel_setup {jogmode} {
for {set idx 0} {$idx < 4} {incr idx} {
set ::XHC_HB04_CONFIG(accel,$idx) 1.0 ;# default if unspecified
}
if [info exists ::XHC_HB04_CONFIG(mpg_accels)] {
set idx 0
foreach g $::XHC_HB04_CONFIG(mpg_accels) {
Expand Down Expand Up @@ -273,7 +276,7 @@ proc wheel_setup {jogmode} {
set afraction [expr $::XHC_HB04_CONFIG(accel,$idx)\
/[set ::AXIS_[set COORD](MAX_ACCELERATION)] ]
} msg] {
err_exit "Missing ini setting: \[AXIS_$COORD\]MAX_ACCELERATION"
err_exit "<$msg>\n\nMissing ini setting: \[AXIS_$COORD\]MAX_ACCELERATION"
}
setp axis.$coord.jog-accel-fraction $afraction

Expand Down Expand Up @@ -301,7 +304,7 @@ proc wheel_setup {jogmode} {
set jfraction [expr $::XHC_HB04_CONFIG(accel,$idx)\
/[set ::JOINT_[set jnum](MAX_ACCELERATION)] ]
} msg] {
err_exit "Missing ini setting: \[JOINT_$jnum\]MAX_ACCELERATION"
err_exit "<$msg>\n\nMissing ini setting: \[JOINT_$jnum\]MAX_ACCELERATION"
}
setp joint.$jnum.jog-accel-fraction $jfraction

Expand Down

0 comments on commit cb934ee

Please sign in to comment.